package com.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public enum Year {
	year1(1, "1990"), year2(2, "1991"), year3(3, "1992"), year4(4, "1993"), year5(5,
			"1994"), year6(6, "1995"), year7(7, "1996"), year8(8, "1997"), year9(9,
			"1998"), year10(10, "1999"), year11(11,"2000"), year12(12, "2001"), year13(
			13, "2002"), year14(14, "2003"), year15(15, "2004"), year16(16, "2005"), year17(
			17, "2006"), year18(18, "2007"), year19(19, "2008"), year20(20, "2009"), year21(
			21, "2010"), year22(22, "2011"), year23(23, "2012"), year24(24, "2013"), year25(
			25, "2014"), year26(26, "2015");

	private int yearId;

	private String yearName;

	private static Map<Integer, Year> constantsMap; 

	private static List<Year> yearList; 

	static {
		constantsMap = new HashMap<Integer, Year>();
		yearList = new ArrayList<Year>();
		for (Year c : Year.values()) {
			yearList.add(c);
			constantsMap.put(c.yearId, c);
		}
	}

	
	public static Year getYearById(Integer yearId) {
		return constantsMap.get(yearId);
	}

		public static String getYearNameById(Integer yearId) {
		return constantsMap.get(yearId).getYearName();
	}

	
	Year(int yearId, String yearName) {
		this.yearId = yearId;
		this.yearName = yearName;
	}

	public int getYearId() {
		return yearId;
	}

	public String getYearName() {
		return yearName;
	}

	
	public static List<Year> getYearList() {
		return yearList;
	}


}
